#import "MovieScreen.h";
#import <QuartzCore/QuartzCore.h>
#import "State.h"
@implementation MovieScreen
@synthesize movieFrames,prompt;
-(void) initWithFrame:(CGRect)frame buffer:(Buffer*)buffer{
	[super initWithFrame:frame];
	self.movieFrames = [[[Sprite alloc] initWithArray:buffer.movieFrames mirror:false] retain];
	self.movieFrames.frame = frame;
	//self.prompt = [[UILabel alloc] init];
	
	[self addSubview:movieFrames];
	//[self addSubview:selection];
	//[self addSubview:prompt];
	startTime= CACurrentMediaTime();
	state = S_MOVIE;
	
}

-(void) init:(Buffer*)buffer
  {
	  CGRect full =CGRectMake(0, 0, 320, 480);
	  [self initWithFrame:full buffer:buffer];
	}


-(int)stateMachine{
    int frame = (int)(CACurrentMediaTime()-startTime)/2;
	[movieFrames setCurrentFrame:frame];
	if(frame >3)
		state=S_MAP_TOWN;
	else
		[movieFrames setNeedsDisplay];
	return state;
}
- (void) action:(int)x y:(int) y{
    state=S_MAP_TOWN;
}
-(void) drawRect:(CGRect)rect{

}
@end

